﻿cmake_minimum_required(VERSION 3.10)
project(interactive-calibration)

find_package(OpenCV REQUIRED)

include_directories(${OpenCV_INCLUDE_DIRS})

file(GLOB SRCS *.cpp)

add_executable(interactive-calibration ${SRCS})

target_link_libraries(interactive-calibration PRIVATE ${OpenCV_LIBS})

if(WIN32)
    file(GLOB OPENCV_DLLS "${OpenCV_DIR}/x64/vc16/bin/opencv_world*.dll")
    add_custom_command(TARGET interactive-calibration POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_if_different
        ${OPENCV_DLLS}
        $<TARGET_FILE_DIR:interactive-calibration>
        COMMENT "Copying OpenCV DLLs to output directory"
    )
endif()

# 将配置文件拷贝到输出目录
add_custom_command(TARGET interactive-calibration POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_if_different
    "${CMAKE_SOURCE_DIR}/defaultConfig.xml"
    $<TARGET_FILE_DIR:interactive-calibration>
    COMMENT "Copying config file to output directory"
)
